import { useState } from "react";
export function useFileImage(file) {
    const [result, setResult] = useState("");
    var reader = new FileReader();
    if (file && typeof file !== "string") {
        reader.readAsDataURL(file); //读取图像文件 result 为 DataURL, DataURL 可直接 赋值给 img.src
        reader.onload = function (event) {
            // console.log(event);
            setResult(event.target.result);
        };
    }
    return result;
}
